package com.rc.saas.mini.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @Author: zcg
 * @CreateDate: 2022/2/9 15:56
 * 只对actuator进行拦截监控
 */
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();//允许post请求
        http.httpBasic()
                .and().authorizeRequests().antMatchers("/actuator/**").authenticated()
                .anyRequest().permitAll();
    }
}
